package com.guo.MyController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.springframework.web.servlet.mvc.LastModified;

@Controller
@RequestMapping("/lastmodified")
public class LMController extends AbstractController implements LastModified {

	private long value = 0l;
	@Override
	public long getLastModified(HttpServletRequest request) {
		value = value == 0 ? System.currentTimeMillis() : value;
		return value;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		response.getWriter().write("<h1>LastModifed</h1>");
		return null;
	}

}
